<template>
 <el-header class="header">
   <div class="logo">
     <a class="logo-name">闲不住</a>
   </div>
   <div class="block text-center" style="position: absolute;left: 30%;right:30%;top:10%;overflow: auto">
     <el-carousel height="150px">
       <el-carousel-item v-for="item in 4" :key="item">
         <h3 class="small justify-center" text="2xl">{{ item }}</h3>
       </el-carousel-item>
     </el-carousel>
   </div>
   <div class="user">
     <div class="block">
       <el-avatar :size="80" :src="circleUrl" />
       <p>您好!-{{user.name}}</p>
     </div>
   </div>
   <el-menu
       :default-active="activeIndex2"
       class="el-menu-demo"
       mode="horizontal"
       background-color="#79bbff"
       text-color="#fff"
       active-text-color="#ffd04b"
       style="position: absolute;bottom: 0px;left: 0px;width: 100%;overflow: auto;"
   >
     <router-link class="router-link" :to="{name:'home'}"><el-menu-item>主页</el-menu-item></router-link>
     <el-sub-menu index="2">
       <template #title>分类导航</template>
       <el-menu-item index="2-1">导航1</el-menu-item>
       <el-menu-item index="2-2">导航2</el-menu-item>
       <el-menu-item index="2-3">导航3</el-menu-item>
     </el-sub-menu>
     <el-menu-item index="3" >看看</el-menu-item>
     <el-menu-item index="4">用户中心</el-menu-item>
     <router-link class="router-link" :to="{name:'login'}"><el-menu-item>登录与注册中心</el-menu-item></router-link>
   </el-menu>
 </el-header>
</template>

<script lang="ts">
//这里在使用相关的回调函数时需要先引入
import {defineComponent, reactive} from 'vue';
import {ElHeader} from "element-plus";
//每次注册的时候需要引入包
export default defineComponent({
  //这个是注册组件
  //入口函数
  name: 'header',
  components: {ElHeader},
  data(){
    return
  },
  setup(){
    const user=reactive({
      name:"XBZ"
    })
    return{
      user
    }
  }
});
</script>

<style scoped>
.header{
  position: absolute;
  height: 250px;
  width: 100%;
  background-image: linear-gradient(to right,#7A88FF, #7AFFAF)
}
.el-menu-demo{
  background-image: linear-gradient(to right, #64bfce, #bd8d9f)
}
.el-carousel__item h3 {
  color: #475669;
  opacity: 0.75;
  line-height: 150px;
  margin: 0;
  text-align: center;
}
.el-carousel__item:nth-child(2n) {
  background-color: #959eab;
}
.el-carousel__item:nth-child(2n + 1) {
  background-color: #e8cfd8;
}
.logo{
  position: absolute;
  left: 10%;
  top: 20%;
}
.logo-name{
  font-family: 'Microsoft YaHei';
  font-size: 50px;
  font-style: oblique;
}
.user{
  position: absolute;
  right: 2%;
  top:5%;
}
.router-link{
  text-decoration: none;
}
</style>
